package com.zhengdongzulin.zuke.app.main.mine

import androidx.lifecycle.rxLifeScope
import com.lxj.androidktx.livedata.StateLiveData
import com.zhengdongzulin.zuke.app.Api
import com.zhengdongzulin.zuke.app.data.ChangeHomeData
import com.zhengdongzulin.zuke.base.BaseViewModel
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse

class MineVm : BaseViewModel() {

    var contract_list_house: StateLiveData<MutableList<ChangeHomeData>> = StateLiveData()

    fun contract_list_house() {
        rxLifeScope.launch(
            {
                var r = RxHttp.postJson(Api.CONTRACT_LIST_HOUSE)
                    .toResponse<MutableList<ChangeHomeData>>()
                    .await()
                contract_list_house.postValueAndSuccess(r)
            }, {
                assignment(it, contract_list_house)
            }
        )
    }

}